package com.kunya.common.util;

import com.kunya.common.common.Const;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

/**
 * @author zp
 * @Description: 公共方法util类
 * @date 2018/6/1 17:05
 */
public class CommonUtil {


    /**
     * @author zp
     * @Description: 从HttpServletRequest对象中获取表前缀公共方法
     * @param httpServletRequest
     * @date 2018/6/1 17:10
     */
    public static String getTablePiefix(HttpServletRequest httpServletRequest){
        return (String) httpServletRequest.getAttribute(Const.TABLE_PREFIX);
    }


    /**
     * @author zp
     * @Description: 根据uuid 获取uuid的至少显著64位转为Long类型
     * @param
     * @date 2018/6/16 17:28
     */
    public static Long getNumber(){
        //以uuid保证唯一
        return Long.valueOf(UUID.randomUUID().getLeastSignificantBits());
    }
}
